import React,{useState,useEffect} from 'react'
//防抖
function useDebonce(value:string,delay=300){
  const [bebonce,setBebonce]=useState(value);
  useEffect(()=>{
    const handle=setTimeout(()=>{
      setBebonce(value)
    },delay)
    return ()=>{
      clearTimeout(handle)
    }
  },[value,delay])
  return bebonce
}

export default useDebonce